package com.example.reggie;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class MyCallable implements Callable<String> {
    @Override
    public String call() throws Exception {
        System.out.println(Thread.currentThread().getName());
        return "ok";
    }


    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable mc = new MyCallable();

        FutureTask<String> fu = new FutureTask<>(mc);
        Thread t1 = new Thread(fu);


        t1.start();
        String s = fu.get();
        System.out.println(s);

    }


}